package com.osdp.auth.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

@Data
@TableName("sys_oauth_client")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class SysOauth2Client {
    /**
     * 主键
     */
    @TableId(type = IdType.ASSIGN_UUID)
    private String id;


    /**
     * 资源ID
     */
    private String resourceIds;

    /**
     * 客户端密钥
     */
    private String clientSecret;

    /**
     * 客户端可选作用域（授权范围）
     */
    private String scope;

    /**
     * 支持的认证方法（授权类型）
     */
    private String authorizedGrantTypes;

    /**
     * 回调地址（跳转网址）
     */
    private String webServerRedirectUri;

    /**
     *
     */
    private String authorities;

    /**
     * token有效期
     */
    private Integer accessTokenValidity;

    /**
     * refresh_token有效期
     */
    private Integer refreshTokenValidity;


    /**
     * 附加信息
     */
    private String additionalInformation;

    /**
     *
     */
    private String autoApprove;

    /**
     * 租户ID
     */
    private String tenantId;
}

/**
 * https://www.cnblogs.com/ifme/p/12188982.html
 *
 CREATE TABLE `sys_oauth_client_details` (
 `id` varchar(32) NOT NULL DEFAULT '',
 `resource_ids` varchar(256) DEFAULT NULL,
 `client_secret` varchar(256) DEFAULT NULL,
 `scope` varchar(20) DEFAULT NULL,
 `authorized_grant_types` varchar(10) DEFAULT NULL,
 `web_server_redirect_uri` varchar(256) DEFAULT NULL,
 `authorities` varchar(256) DEFAULT NULL,
 `access_token_validity` int(10) DEFAULT NULL,
 `refresh_token_validity` int(10) DEFAULT NULL,
 `additional_information` varchar(4096) DEFAULT NULL,
 `auto_approve` varchar(100) DEFAULT NULL,
 `tenant_id` varchar(128) DEFAULT NULL,
 PRIMARY KEY (`id`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8
 */